*Cloud plot sep by decade*

clear

use "Data\kmeans ambition types.dta"

**Keep only those for who we observe ambition type**
keep if wage_growth_ambition!=.

*Keep only couples where we observe both partners
gen temp2=koen
destring temp2, replace
by couple_id aar, sort: egen temp3=mean(temp2)
keep if temp3==1.5
drop temp2 temp3

sort pnr aar

merge 1:1 pnr aar using "Results\tab_B3\Scenario_3\joining_couples.dta"

drop _merge

**Make map
sort pnr aar

gen temp=educ_eika if final_educ==hfaudd
by pnr: egen final_educ_level_3=mean(temp)
drop temp

forvalues i=81(1)85{

replace final_educ_level_3=1 if final_educ==1109`i'
replace final_educ_level_3=1 if final_educ==1110`i'
replace final_educ_level_3=1 if final_educ==1107`i'
replace final_educ_level_3=1 if final_educ==1008`i'
replace final_educ_level_3=1 if final_educ==1023`i'
replace final_educ_level_3=1 if final_educ==1123`i'
replace final_educ_level_3=1 if final_educ==1009`i'
replace final_educ_level_3=1 if final_educ==1022`i'
replace final_educ_level_3=1 if final_educ==1010`i'

}

gen temp=fined if final_educ==hfaudd
by pnr: egen final_educ_level_4=mean(temp)
drop temp

forvalues i=81(1)85{

replace final_educ_level_4=1 if final_educ==1109`i'
replace final_educ_level_4=1 if final_educ==1110`i'
replace final_educ_level_4=1 if final_educ==1107`i'
replace final_educ_level_4=1 if final_educ==1008`i'
replace final_educ_level_4=1 if final_educ==1023`i'
replace final_educ_level_4=1 if final_educ==1123`i'
replace final_educ_level_4=1 if final_educ==1009`i'
replace final_educ_level_4=1 if final_educ==1022`i'
replace final_educ_level_4=1 if final_educ==1010`i'

}


gen dum=1 if aar==1989 & final_educ_year<=1989
replace dum=1 if aar==1999 & final_educ_year>=1990 & final_educ_year<=1999
replace dum=1 if aar==2018 & final_educ_year>=2000

keep if dum==1
drop dum
drop if final_educ==. | final_educ==1
sort final_educ

by final_educ: egen final_educ_level_group_3=mean(final_educ_level_3)
by final_educ: egen final_educ_level_group_4=mean(final_educ_level_4)

*first
gen temp=ambition_type_sep if final_educ_year<=1989
by final_educ: egen ambition_type_first=mean(temp)
drop temp

gen temp=wage_start_mean_ambition_s_first
by final_educ: egen level_mean_s_first=mean(temp)
drop temp

gen temp=wage_growth_ambition_s_first
by final_educ: egen growth_mean_s_first=mean(temp)
drop temp

gen temp=1 if final_educ_year<=1989
by final_educ: egen educ_count_first=count(temp)
drop temp

*second
gen temp=ambition_type_sep if final_educ_year>=1990 & final_educ_year<=1999
by final_educ: egen ambition_type_sec=mean(temp)
drop temp

gen temp=wage_start_mean_ambition_s_sec
by final_educ: egen level_mean_s_sec=mean(temp)
drop temp

gen temp=wage_growth_ambition_s_sec
by final_educ: egen growth_mean_s_sec=mean(temp)
drop temp

gen temp=1 if final_educ_year>=1990 & final_educ_year<=1999
by final_educ: egen educ_count_sec=count(temp)
drop temp

*third
gen temp=ambition_type_sep if final_educ_year>=2000
by final_educ: egen ambition_type_third=mean(temp)
drop temp

gen temp=wage_start_mean_ambition_s_third
by final_educ: egen level_mean_s_third=mean(temp)
drop temp

gen temp=wage_growth_ambition_s_third
by final_educ: egen growth_mean_s_third=mean(temp)
drop temp

gen temp=1 if final_educ_year>=2000
by final_educ: egen educ_count_third=count(temp)
drop temp


collapse (first) level_mean_s_first growth_mean_s_first educ_count_first ambition_type_first level_mean_s_sec growth_mean_s_sec educ_count_sec ambition_type_sec level_mean_s_third growth_mean_s_third educ_count_third ambition_type_third final_educ_level_group_3 final_educ_level_group_4 ambition_type_k_3_s ambition_type_k_4_s ambition_type_k_5_s, by(final_educ)

gen educ_code=string(final_educ)


*Fig B7a
*Fig first
twoway scatter growth_mean_s_first level_mean_s_first if ambition_type_first==1 & educ_count_first>=10, msymbol(diamond_hollow) mcolor(teal) || ///
scatter growth_mean_s_first level_mean_s_first if ambition_type_first==2 & educ_count_first>=10, msymbol(square_hollow) mcolor(navy) || ///
scatter growth_mean_s_first level_mean_s_first if ambition_type_first==3 & educ_count_first>=10, msymbol(triangle_hollow) mcolor(dkorange) || ///
scatter growth_mean_s_first level_mean_s_first if ambition_type_first==4 & educ_count_first>=10, msymbol(circle_hollow) mcolor(maroon) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)

*Fig B7c
*Fig sec
twoway scatter growth_mean_s_sec level_mean_s_sec if ambition_type_sec==1 & educ_count_sec>=10, msymbol(diamond_hollow) mcolor(teal) || ///
scatter growth_mean_s_sec level_mean_s_sec if ambition_type_sec==2 & educ_count_sec>=10, msymbol(square_hollow) mcolor(navy) || ///
scatter growth_mean_s_sec level_mean_s_sec if ambition_type_sec==3 & educ_count_sec>=10, msymbol(triangle_hollow) mcolor(dkorange) || ///
scatter growth_mean_s_sec level_mean_s_sec if ambition_type_sec==4 & educ_count_sec>=10, msymbol(circle_hollow) mcolor(maroon) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)

*Fig B7e
*Fig third
twoway scatter growth_mean_s_third level_mean_s_third if ambition_type_third==1 & educ_count_third>=10, msymbol(diamond_hollow) mcolor(teal) || ///
scatter growth_mean_s_third level_mean_s_third if ambition_type_third==2 & educ_count_third>=10 & growth_mean_s_third>-5 & level_mean_s_third<6, msymbol(square_hollow) mcolor(navy) || ///
scatter growth_mean_s_third level_mean_s_third if ambition_type_third==3 & educ_count_third>=10, msymbol(triangle_hollow) mcolor(dkorange) || ///
scatter growth_mean_s_third level_mean_s_third if ambition_type_third==4 & educ_count_third>=10, msymbol(circle_hollow) mcolor(maroon) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)


***Examples

*Fig B7b
*first

gen program_name=""

replace program_name="Preschool teacher*" if educ_code=="5445" /*1*/

replace program_name="Carpenter" if educ_code=="4283" /*2*/
replace program_name="Teacher" if educ_code=="5440" /*2*/
replace program_name="Nurse" if educ_code=="5166" /*2*/
replace program_name="Architect" if educ_code=="5470" /*2*/

replace program_name="Office clerk" if educ_code=="4981" /*3*/
replace program_name="Business HS" if educ_code=="5098" /*3*/
replace program_name="10th grade*" if educ_code=="111084" /*3*/
replace program_name="Bank advisor" if educ_code=="4986" /*3*/
replace program_name="Ordinary HS*" if educ_code=="1181" /*3*/


replace program_name="Business grad" if educ_code=="5703" /*4*/
replace program_name="Medicin" if educ_code=="7170" /*4*/
replace program_name="Law" if educ_code=="7085" /*4*/
replace program_name="Business bach" if educ_code=="5700" /*4*/


twoway scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "5445"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "5440"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(4) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "4981"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "5703"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "1181"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(2) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "5166"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "4283"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code,"5470"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "5098"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "111084"),  msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "4986"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code, "5700"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code,"7170"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_first level_mean_s_first if inlist(educ_code,"7085"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)



*Fig B7d
*second
drop program_name
gen program_name=""

replace program_name="Office clerk" if educ_code=="4981" /*1*/
replace program_name="10th grade*" if educ_code=="111084" /*1*/
replace program_name="Ordinary HS*" if educ_code=="1181" /*1*/

replace program_name="Preschool teacher" if educ_code=="5444" /*2*/
replace program_name="Carpenter" if educ_code=="4283" /*2*/
replace program_name="Teacher" if educ_code=="5440" /*2*/
replace program_name="Nurse" if educ_code=="5166" /*2*/

replace program_name="Business HS" if educ_code=="5098" /*3*/
replace program_name="Bank advisor" if educ_code=="4986" /*3*/
replace program_name="Business bach" if educ_code=="5700" /*3*/

replace program_name="Business grad" if educ_code=="5703" /*4*/
replace program_name="Medicin" if educ_code=="7170" /*4*/
replace program_name="Law" if educ_code=="7085" /*4*/
replace program_name="Architect" if educ_code=="5470" /*4 NOT one of biggest*/


twoway scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "4981"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "5444"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(4) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "5098"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "5703"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "1181"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(2) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "5166"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(11) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "4283"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code,"5470"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "5700"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(2) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "111084"),  msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(6) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "4986"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(6) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code, "5440"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code,"7170"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_sec level_mean_s_sec if inlist(educ_code,"7085"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)



*Fig B7f
*third
drop program_name
gen program_name=""

replace program_name="Office clerk" if educ_code=="4981" /*1*/
replace program_name="Ordinary HS" if educ_code=="1198" /*1*/
replace program_name="Preschool teacher" if educ_code=="5444" /*1*/

replace program_name="Carpenter" if educ_code=="4283" /*2*/
replace program_name="Teacher" if educ_code=="5440" /*2*/
replace program_name="Nurse" if educ_code=="5166" /*2*/
replace program_name="Architect" if educ_code=="5470" /*2 NOT one of biggest*/

replace program_name="Business HS" if educ_code=="5098" /*3*/
replace program_name="10th grade*" if educ_code=="111084" /*3*/

replace program_name="Business grad" if educ_code=="5703" /*4*/
replace program_name="Medicin" if educ_code=="7170" /*4*/
replace program_name="Law" if educ_code=="7085" /*4*/
replace program_name="Bank advisor" if educ_code=="4986" /*4*/
replace program_name="Business bach" if educ_code=="5700" /*4*/



twoway scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "4981"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(10) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "4283"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "5098"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "5703"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "1198"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(7) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "5166"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "5444"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(6) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code,"5470"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "5700"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(2) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "111084"),  msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "4986"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code, "5440"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code,"7170"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_third level_mean_s_third if inlist(educ_code,"7085"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)





